<template>
  <div class="dialog-container">
    <el-dialog
      :title="title"
      :visible.sync="innerVisible"
      :close-on-click-modal="false"
      @open="onOpen"
      @opened="onOpened"
      @close="onClose"
      @closed="onClosed"
    />
  </div>
</template>
<script>
export default {
  props: {
    title: {
      type: String,
      default: '',
      require: true
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
    }
  },
  computed: {
    innerVisible: {
      get() {
        return this.visible
      },
      set(val) {
        this.$emit('update:visible', val)
      }
    }
  },
  created() {},
  methods: {
    onOpen() {
      this.$emit('open')
    },
    onOpened() {
      this.$emit('opened')
    },
    onClose() {
      this.$emit('close')
    },
    onClosed() {
      this.$emit('closed')
    }
  }
}
</script>
